Callback

abstract class Callback(source)

A Callback is used as a communication channel with the ViewDragHelper back to the parent view using it. on*methods are invoked on siginficant events and several accessor methods are expected to provide the ViewDragHelper with more information about the state of the parent view upon request. The callback also makes decisions governing the range and draggability of child views.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun clampViewPositionHorizontal(@NonNull child: @NonNull View, left: Int, dx: Int): Int
Restrict the motion of the dragged child view along the horizontal axis.
Link copied to clipboard
open fun clampViewPositionVertical(@NonNull child: @NonNull View, top: Int, dy: Int): Int
Restrict the motion of the dragged child view along the vertical axis.
Link copied to clipboard
open fun getOrderedChildIndex(index: Int): Int
Called to determine the Z-order of child views.
Link copied to clipboard
open fun getViewHorizontalDragRange(@NonNull child: @NonNull View): Int
Return the magnitude of a draggable child view's horizontal range of motion in pixels.
Link copied to clipboard
open fun getViewVerticalDragRange(@NonNull child: @NonNull View): Int
Return the magnitude of a draggable child view's vertical range of motion in pixels.
Link copied to clipboard
open fun onEdgeDragStarted(edgeFlags: Int, pointerId: Int)
Called when the user has started a deliberate drag away from one of the subscribed edges in the parent view while no child view is currently captured.
Link copied to clipboard
open fun onEdgeLock(edgeFlags: Int): Boolean
Called when the given edge may become locked.
Link copied to clipboard
open fun onEdgeTouched(edgeFlags: Int, pointerId: Int)
Called when one of the subscribed edges in the parent view has been touched by the user while no child view is currently captured.
Link copied to clipboard
open fun onViewCaptured(@NonNull capturedChild: @NonNull View, activePointerId: Int)
Called when a child view is captured for dragging or settling.
Link copied to clipboard
open fun onViewDragStateChanged(state: Int)
Called when the drag state changes.
Link copied to clipboard
open fun onViewPositionChanged(@NonNull changedView: @NonNull View, left: Int, top: Int, @Px dx: Int, @Px dy: Int)
Called when the captured view's position changes as the result of a drag or settle.
Link copied to clipboard
open fun onViewReleased(@NonNull releasedChild: @NonNull View, xvel: Float, yvel: Float)
Called when the child view is no longer being actively dragged.
Link copied to clipboard
abstract fun tryCaptureView(@NonNull child: @NonNull View, pointerId: Int): Boolean
Called when the user's input indicates that they want to capture the given child view with the pointer indicated by pointerId.